/*
 * @Date: 2019-11-06 10:43:22
 * @LastEditors: peng qiao
 * @LastEditTime: 2020-03-28 15:43:33
 */
import Vue from 'vue'
import App from './App.vue'
import router, {
  hook as routerHook
} from './router'
import store from './store'
import Vant from 'vant'
import 'vant/lib/index.css'
import 'vant/lib/icon/local.css'
import 'lib-flexible'
import './icons'
import VideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
Vue.use(VideoPlayer)
import {
  Lazyload
} from 'vant'

Vue.use(Vant)
Vue.use(Lazyload, {
  error: require('@/assets/err.png'),
  attempt: 1
})
Vue.config.productionTip = false

routerHook()

// document.addEventListener("deviceready", function () {
  let testVueInstance = new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount("#app")
  var time;
  document.addEventListener("backbutton", function () {
    var pp = new Date() - time
    var x = document.getElementById('exit')
    if (x) {
      if (pp < 2000) {
        navigator.Backbutton.goHome()
      } else {
        testVueInstance.$toast('再按一次退出应用')
        time = new Date()
      }
    } else {
      testVueInstance.$router.back(-1)
    }
  }, false);
// }, false);